import React, { Component } from 'react'

import {connect} from 'react-redux' 

import {createJiaAction} from '../../redux/count_action'
class Count extends Component {
    add = ()=>{
        // 点击加1
        this.props.add(1)
    }

    render() {
        return (
            <div>
                <h2>当前求和是:{this.props.sum}</h2>
                <button onClick={this.add}>点击加1</button>
            </div>
        )
    }
}

export default connect(
    // 状态
    state => ({sum:state}),
    // 操作状态的方法
    ({
        add:createJiaAction
    })
)(Count)